-
Notifications
You must be signed in to change notification settings - Fork 1.9k
feat(InputBinding): subscribe callback now supports event priority #4211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
95f1c08
to
b77ef5e
Compare
b77ef5e
to
157d489
Compare
Co-authored-by: Copilot <[email protected]>
This explanation is the first time I've seen If we're updating the API, I'd love to push it in a direction that supports a more readable interface. I.e. in addition to backcompat for callback(true)
callback({ priority: "deferred" })
callback(false)
callback({ priority: "immediate" })
// or now also
callback({priority: "event"}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Just a small note to make sure the PR includes a demo snippet with the new feature
* main: (32 commits) Revert the addition of spacing between `icon` and `label` in `actionButton()` (#4248) Restrict `icon`/`label` separator spacing to `actionButton()` (#4247) Fix front-end action button label updating logic (#4242) Update news Properly handle undefined value for input subscribe callback (#4243) Start new version (#4241) v1.11.0 release candidate (#4232) Follow up to #3996: fix front-end checkbox label updating logic (#4238) feat(InputBinding): subscribe callback now supports event priority (#4211) Follow up to #3996 when label is unspecified (i.e., NULL), don't include it in the message (#4237) Run routine (#4234) chore: #4175 update jquery-ui to 1.14.1 (#4205) Update jQuery to 3.7.1 (#3969) Fix 404 in example 08_html (shiny.min.css) (#4221) Follow up to #3870: fix location of news item (#4233) Bugfix for error found in tests (#3870) Allow update input labels with HTML (#3996) Adds mirai to documentation (#4230) family->given for R Core authorship (#4222) fix(renderPlot): get interactive plotting working with ggplot2 v4.0 (#4228) ...
Closes #308 The subscribe callback now expects an object with the priority after this PR rstudio/shiny#4211. So, if you update to `shiny v1.11.1` the `draggable_buckets` do not work (the init works, but since the subscribe is broken it does not update). In the future we can think about using [`sortable`](https://rstudio.github.io/sortable/) package to replace a huge chunk of custom css/js code.
Until now, custom input bindings could only pass a boolean value to their subscribe callback. That is, do something similar to this to notify Shiny of a change:
These boolean values map to values of
priority: "deferred"
(true
) andpriority: "immediate"
(false
), meaning 'send later & debounce' or 'send now'.With this PR, you can now:
priority
as an object, making the code more readable/explicit (i.e.,callback({priority: "deferred"})
{priority: "event"}
to always send now, even if the value hasn't changed.For example:
The motivator for adding this is for
input_submit_textarea()
in rstudio/bslib#1204, where it feels like the most desirable behavior is to always resend immediately.